<template>
  <div class="main">
    <div>
      <span style="font-weight:bold;color:rgb(34,34,34)">注册账号</span>
      <span style="color:red;">*</span>
      <x-input
        class="input"
        v-model="formAdd.zczh"
        :show-clear="true"
        placeholder="请输入手机号"
        type="tel"
      ></x-input>

      <span style="font-weight:bold;color:rgb(34,34,34)">密码</span>
      <span style="color:red;">*</span>
      <x-input
        class="input"
        v-model="formAdd.mm"
        :show-clear="true"
        placeholder="请输入密码"
        type="password"
      ></x-input>
      <span style="font-weight:bold;color:rgb(34,34,34)">确认密码</span>
      <span style="color:red;">*</span>
      <x-input
        class="input"
        v-model="formAdd.qrmm"
        :show-clear="true"
        placeholder="请输入确认密码"
        type="password"
      ></x-input>
    </div>

    <x-button type="primary" @click.native="register">注册</x-button>
  </div>
</template>
<script>
import { XInput, Group, XTextarea, XTable, XButton } from "vux";
export default {
  components: {
    XInput,
    Group,
    XTextarea,
    XTable,
    XButton
  },
  data() {
    return {
      formAdd: {
        zczh: "", //注册账户
        mm: "", //密码
        qrmm: "" //确认密码
      }
    };
  },
  methods: {
    /************************************注册****************************** */
    register() {
      if(this.formAdd.zczh.trim){

console.log(this.formAdd.zczh)
      }
      if (/^\s+$/gi.test(this.formAdd.zczh)) {
        this.toastFail("注册账户不能包含空格", "160px");
        return;
      } else if (!this.formAdd.zczh) {
        this.toastFail("请输入注册账号", "160px");
        return;
      } else if (/^\s+$/gi.test(this.formAdd.mm)) {
        this.toastFail("密码不能包含空格", "160px");
        return;
      } else if (!this.formAdd.mm) {
        this.toastFail("请输入密码", "160px");
        return;
      } else if (/^\s+$/gi.test(this.formAdd.mm)) {
        this.toastFail("确认密码不能包含空格", "160px");
        return;
      } else if (!this.formAdd.qrmm) {
        this.toastFail("请输入确认密码", "160px");
        return;
      } else if (this.formAdd.mm != this.formAdd.qrmm) {
        this.toastFail("两次输入密码不一致，请重新输入", "160px");
        return;
      } else {
        this.$vux.loading.show();
        this.$post("/anapi/WxGzdController/addOne", this.formAdd, data => {
          this.$vux.alert.show({
            title: "提示",
            content: "登陆成功",
            onShow() {},
            onHide() {}
          });
          // this.goBack()
        });
      }
    }
  }
};
</script>




<style lang="less" scoped>
.input {
  border: 1px solid rgb(214, 212, 212);
  width: 100%;
  height: 35px;
  padding: 0px;
  margin-bottom: 20px;
}
.main {
  padding: 20px;
}
</style>